package ro.msg.quiz.domain;

import java.util.ArrayList;
import java.util.List;

//AUTHOR: Marco,Razvan,Elod

//Object that has id, question text, list of possible answers,
//index, that represent the correct answer, for the previous list
public class SingleChoiceQuestion extends Question {

    private List<String> options;
    private int correctIndex;

    public SingleChoiceQuestion(int id, String text, List<String> options, int correctIndex) {
	super(id, text);
	this.options = new ArrayList<String>();
	this.setOptions(options);
	this.setCorrectIndex(correctIndex);
    }

    /**
     * @return the type
     */
    @Override
    public QuestionType getType() {
	return QuestionType.SINGLE_CHOICE_Q;
    }

    /**
     * @return the options
     */
    public List<String> getOptions() {
	return options;
    }

    /**
     * @param options
     *            the options to set
     */
    public void setOptions(List<String> options) {
	this.options = options;
    }

    /**
     * @return the correctIndex
     */
    public int getCorrectIndex() {
	return correctIndex;
    }

    /**
     * @param correctIndex
     *            the correctIndex to set
     */
    public void setCorrectIndex(int correctIndex) {
	this.correctIndex = correctIndex;
    }

    @Override
    public String toString() {
	return this.getId() + " " + this.getType().get() + " '" + this.getText() + "' '" + this.options + " " + this.correctIndex;
    }

}
